/**
 * 业务步骤配置管理
 */
import request from '@/utils/request';

//查询业务步骤
export function query(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/step',
		method: 'post',
		data: data,
	});
}

//新增或修改业务步骤
export function add(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/step/save',
		method: 'post',
		data: data,
	});
}

//新增或修改业务步骤
export function edit(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/step',
		method: 'put',
		data: data,
	});
}

//确认业务步骤
export function confirm(ids: string): ApiPromise<ApiResponse> {
	return request({
		url: '/management/step/confirm/' + ids,
		method: 'get',
		data: ids,
	});
}

//取消业务步骤
export function cancel(ids: string): ApiPromise<ApiResponse> {
	return request({
		url: '/management/step/cancel/' + ids,
		method: 'get',
		data: ids,
	});
}

//删除业务步骤
export function remove(ids: string): ApiPromise<ApiResponse> {
	return request({
		url: '/management/step/delete/' + ids,
		method: 'delete',
	});
}

//获取专属指标
export function getIndicator(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/exclusiveIndicator',
		method: 'post',
		data: data,
	});
}

//获取配置组合策略
export function getStrategy(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/step/getStrategy',
		method: 'post',
		data: data,
	});
}

//保存配置组合策略
export function saveStrategy(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/step/saveStrategy',
		method: 'post',
		data: data,
	});
}

//查询相同系统下共用步骤的业务
export function queryBusiness(data: any): ApiPromise<ApiResponse> {
	return request({
		url: `/management/step/getShareBusiness/${data.systemId}/${data.stepId}/${data.stepCode}`,
		method: 'post',
	});
}

// 查询系统名称
export function system(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/option/system',
		method: 'get',
	});
}

// 查询业务名称
export function business(systemId: string | number): ApiPromise<ApiResponse> {
	return request({
		url: `/management/option/business?systemId=${systemId}`,
		method: 'get',
	});
}

// 查询系统名称
export function step(businessCode?: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/option/step',
		method: 'get',
		params: { businessCode: businessCode },
	});
}
